package vip.zcn.mrn.service.impl;

import org.springframework.stereotype.Service;
import vip.zcn.mrn.model.Person;
import vip.zcn.mrn.service.IdCardService;
import vip.zcn.mrn.util.MaskUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 身份证服务实现类
 * @author 张灿能
 * @create: 2025-08-04 15:15
 */
@Service
public class IdCardServiceImpl implements IdCardService {

    private static final Map<String, Person> personMap = new HashMap<>();
    static {
        Person p = new Person();
        p.setName("张三");
        p.setIdCard("123456199001012345");
        personMap.put(p.getName(), p);
    }

    @Override
    public Person getPersonMasked(String name) {
        Person p = personMap.get(name);
        if (p == null) return null;
        Person masked = new Person();
        masked.setName(p.getName());
        masked.setIdCard(MaskUtil.maskIdCard(p.getIdCard()));
        return masked;
    }

    @Override
    public Person getPersonFull(String name) {
        return personMap.get(name);
    }
    
}
